package tt.com.financialmanagement.controller;

import com.sun.org.apache.xpath.internal.operations.Or;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import tt.com.common.model.Order;
import tt.com.common.util.PageUtil;
import tt.com.financialmanagement.service.OrderService;

@RestController
@RequestMapping(value = "finance/business")
//财务的前端-后端/api/finance/business/xxxx
public class OrderController {
    @Autowired
    private OrderService orderService;
    //擦寻已经生成订单，接单状态为未接单的
    @PostMapping(value = "select/unorders")
    public ResponseEntity selectUnorders(@RequestBody PageUtil pageUtil){
        return orderService.selectOrder(pageUtil);
    }
    //擦寻已经生成订单，接单状态为已经接单的
    @PostMapping(value = "select/orders")
    public ResponseEntity selectOrders(@RequestBody PageUtil pageUtil){
        return orderService.selectOrderTwo(pageUtil);
    }
//    //根据不同的服务项目进行分类
    @PostMapping(value = "selec/ordersByid")
    public ResponseEntity selectOrdersById(@RequestBody Order order){
        return orderService.selectOrderById(order.getOrganId());

    }
    //删除订单
    @PostMapping(value = "delect/orders")
    public ResponseEntity delectOrders(@RequestBody Order order){
        return orderService.delectOrder(order);
    }

    //查询已经完成的订单，数量
    @PostMapping(value = "select/finish")
    public ResponseEntity selectFinish(@RequestBody PageUtil pageUtil){
        return orderService.selecFinish(pageUtil);
    }
    //返回已完成订单的金额
    @PostMapping(value = "back/money")
    public ResponseEntity backMoney(){
        return orderService.backMoney();
    }
    //返回不同步类型的订单及金额
    @PostMapping(value = "back/moneybyid")
    public ResponseEntity backMoneyById(@RequestBody Order order){
        return orderService.backMoneyById(order.getOrganId());
    }

}

